﻿namespace Vdc.Grid
{
    using System;
    using System.Threading;
    using System.Web.UI;

    public class RuntimeTemplate : ITemplate
    {
        public event GridRuntimeTemplateEventHandler CreateTemplate;

        public void InstantiateIn(Control container)
        {
            TemplateContainer container2 = container as TemplateContainer;
            this.OnCreateTemplate(new GridRuntimeTemplateEventArgs(container2));
        }

        protected virtual void OnCreateTemplate(GridRuntimeTemplateEventArgs e)
        {
            e.Container.Controls.Clear();
            if (this.CreateTemplate != null)
            {
                this.CreateTemplate(this, e);
            }
        }
    }
}

